package com.mall.shopping.converter;

import com.mall.shopping.dal.entitys.Item;
import com.mall.shopping.dto.CartProductDto;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

/**
 * create by heyyon 2020-12-21 17:16
 */
@Mapper(componentModel = "spring")
public interface CartProductConverter {
    @Mappings({
            @Mapping(source = "id", target = "productId"),
            @Mapping(source = "price", target = "salePrice"),
            @Mapping(source = "num", target = "productNum"),
            @Mapping(source = "limitNum", target = "limitNum"),
            @Mapping(source = "title", target = "productName"),
            @Mapping(source = "image", target = "productImg")
    })
    CartProductDto item2CartProductDto(Item item);
}
